import service from "@/utils/service";
import type { BaseResponse, baseDelRequest, paramsType } from "./index.d";

export const baseDeleteApi = (
  url: string,
  idList?: baseDelRequest
): Promise<BaseResponse<string>> => {
  return service({
    url,
    method: "DELETE",
    data: idList,
  });
};
export const basePostApi = (
  url: string,
  formDate: any
): Promise<BaseResponse<string>> => {
  return service({
    url,
    method: "POST",
    data: formDate,
  });
};
export const basePutApi = (
  url: string,
  formDate: any
): Promise<BaseResponse<string>> => {
  return service({
    url,
    method: "PUT",
    data: formDate,
  });
};

export interface optionsType {
  label: string;
  value: string | number;
}

export type optionsFunc = (
  params?: paramsType
) => Promise<BaseResponse<optionsType[]>>;
